<?php
echo $this->Html->css("estilo.css");
echo $this->Html->script("http://maps.googleapis.com/maps/api/js?sensor=false");
echo $this->Html->script("jquery.min");
echo $this->Html->script("mapaDeProdutos");
echo $this->Html->script("jquery-ui.custom.min");
?>
<div style="width: 100%; background-color: #83BB2B;">
    <?php echo $this->Form->create('Produto');?>

    <div style="padding:20px;">
        <form action="/incorpore/" id="ProdutoSearchForm" method="post" accept-charset="utf-8" class="form-search form-inline">
            <div style="display:none;"><input type="hidden" name="_method" value="POST"></div>    
            <div class="input-group">
                <input  name="data[Produto][nome]" id="ProdutoNome" type="text" class="form-control search-query" placeholder="<?php echo __('Nome do resíduo') ?>" /> 
                <span class="input-group-btn">
                    <button type="submit" class="btn btn-danger"> <?php echo __('Pesquisar') ?></button>
                </span>

            </div>
        </form>
    </div>

</div>
<div class="products form">
    <div class="respostas">
        <article>
            <table class="table table-striped table-bordered table-hover">
                <tr>
                    <?php if ($busca!=null) {?>
                    <th><?php echo __('Nome Científico')?></th>
                    <th><?php echo __('Nome Comercial')?></th>
                    <th><?php echo __('Laboratório')?></th>
                    <th><?php echo __('Reserva')?></th>
                    <?php }?>
                </tr>
                <?php foreach ($busca as $data) { ?>
                    <tr>
                        <td><?php echo $data['Produto']['nome_cientifico'] ?></td>
                        <td><?php echo $data['Produto']['nome_comercial'] ?></td>
                        <td><?php echo $data['Laboratorio']['nome'] ?></td>
                        <td><?php echo $this->Html->link(__('Reservar'), array('controller' => 'Reservas', 'action' => 'reserva', $data['Produto']['id']), array('title' => __('Solicitar reserva'), 'class' => 'btn btn-success btn-primary btn-xs')) ?></td>
                        
                            <!--<a id="$data['Laboratorio']['latitude']" name='longitude'><?php // echo $data['Laboratorio']['longitude'] ?></a>-->
                            <script>
                                $(function() {
                                    addMarker("<?= $data['Laboratorio']['latitude'] ?>", "<?= $data['Laboratorio']['longitude'] ?>", "<?= $data['Produto']['id']?>");
                                });
                            </script>
                        
                    </tr>
                <?php } ?>
            </table>
        </article>
        <div id="mapa"></div>   
    </div>    
</div>
